﻿using BLL.Interface;
using Microsoft.AspNetCore.Mvc;

namespace TianXiaHuiForumManagementSystem.Controllers.System
{
    [Route("System/[controller]")]
    [ApiController]
    public class SystemController : ControllerBase
    {
        private readonly ISystemBLL _systemBLL;
        public SystemController(ISystemBLL systemBLL)
        {
            _systemBLL = systemBLL;
        }
        /// <summary>
        /// 初始化数据库
        /// </summary>
        /// <returns></returns>
        [HttpPost, Route("InitDatabase")]
        public ActionResult InitDatabase()
        {
            try
            {
                _systemBLL.InitDatabase();
                return Ok("初始化数据库成功");
            }
            catch (Exception ex)
            {
                return BadRequest(ex.Message);
            }
        }
    }
}
